package org.gvp.generator.props;

import lombok.Data;

@Data
public class ProjectProps {

    /**
     * 项目组名字,包路径前缀: org.gvp
     */
    private String groupId = "org.gvp";
    /**
     * 项目字模块名字,二级包名: manager
     */
    private String moduleName = "manager";
    /**
     * 项目实体类包名: 如 pojo vo entity ,默认为pojo
     */
    private String entityPackage = "pojo";

    /**
     * 项目Mybatis Mapper层包名: 如 mapper ,默认mapper
     */
    private String mapperPackage = "mapper";
    /**
     * 项目数据层包名: 如 repository ,默认repository
     */
    private String repositoryPackage = "repository";
    /**
     * 项目服务层包名: 如 service ,默认service
     */
    private String servicePackage = "service";
    /**
     * 项目控制层包名: 如 controller ,默认controller
     */
    private String controllerPackage = "controller";

    /**
     * Mybatis mapper配置文件路径,基于resources目录,默认为src/main/resources/mapper
     */
    private String xmlDirPath = "config/mapper";

    /**
     * typescript类型文件路径,基于resources目录,默认为src/main/resources/ts
     */
    private String typescriptDirPath = "ts";
    /**
     * 请求路径的前缀,默认为空
     */
    private String requestMappingPrefix = "";
    /**
     * 请求路径的别名,默认为数据表名
     */
    private String requestMappingAlias = "";
    /**
     * 完整的实体类包名导入
     */
    private String entityImport;
    /**
     * 项目java代码路径
     */
    private String javaPath;
    /**
     * 项目资源文件路径
     */
    private String resourcePath;
    /**
     * 基础的包定义前缀
     */
    private String basePackageImport;
    /**
     * 基础的包导入前缀
     */
    private String baseImport;

    /**
     * 构建完整的实体类包名导入
     */
    public void buildEntityImportName(String entityName){
        this.entityImport = "import %s.%s.%s.%s;".formatted(this.groupId,this.moduleName,this.entityPackage,entityName);
    }

    public void buildBasePackage() {
       this.basePackageImport = "package %s.%s.".formatted(this.groupId,this.moduleName);
       this.baseImport = "import %s.%s.".formatted(this.groupId,this.moduleName);
    }


}
